package com.zzz.system.vo;

import com.zzz.codegen.config.GlobalConfig;
import com.zzz.codegen.config.TemplateConfig;
import com.zzz.framework.util.MyBeanUtil;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

@Accessors(chain = true)
@Getter
@Setter
@NoArgsConstructor
public class TemplateVO {
    private Long id;

    private String code;

    private String groupCode;

    /**
     * 类的前缀。
     */
    private String classPrefix;

    /**
     * 类的后缀。
     */
    private String classSuffix;

    /**
     * 包路径
     */
    private String packagePath;

    private String content;

    private String dataSourceCode;

    private String tableName;

    /**
     * 生成文件内容
     */
    private String createFileContent;

    /**
     * 生成文件路径
     */
    private String createFilePath;

    public TemplateConfig toTemplateConfig() {
        TemplateConfig config = new TemplateConfig();
        MyBeanUtil.copyBean(this, config);
        config.setGenType(code).setTemplateContent(content).setFileBuilder(GlobalConfig.javaFileBuilder);
        return config;
    }
}
